import random

# V1.0
# a = random.randint(1,100)
# flag = 1
# while flag:
#     b = int(input("请输入数字(范围1-100):"))
#
#     if b>100 or b <1:
#         print("不按规则输入，罚你给V我50")
#     elif b<a:
#         print("小了")
#     elif  b>a:
#         print("大了")
#     else:
#         print("恭喜猜中，本轮幸运数字:{}".format(a))
#         flag = 0;

# V2.0
# a = random.randint(1, 100)
# coin = 5000
# while coin > 0:
#     b = int(input("请输入数字(范围1-100):"))
#     if b > 100 or b < 1:
#         print("不按规则输入，罚你给V我50")
#         coin-=50
#         print("剩余金额：",coin)
#     elif b>a:
#         print("大了，罚你给我500块")
#         coin-=500
#         print("剩余金额：",coin)
#     elif b<a:
#         print("小了，罚你给我500块")
#         coin-=500
#         print("剩余金额：", coin)
#     else:
#         print("你猜对了，数字是{}，罚我给你3000块".format(a))
#         a = random.randint(1, 100)
#         coin+=3000
#         print("剩余金额：", coin)


# V3.0
a = random.randint(1, 100)
coin = 5000
while coin > 0:
    b = int(input("请输入数字(范围1-100):"))
    if b > 100 or b < 1:
        print("不按规则输入，罚你给V我50")
        coin-=50
        print("剩余金额：",coin)
    elif b > a:
        print("大了，罚你给我500块")
        coin -= 500
        print("剩余金额：", coin)
    elif b < a:
        print("小了，罚你给我500块")
        coin -= 500
        print("剩余金额：", coin)
    elif b==a :
        print("你猜对了，数字是{}，罚我给你3000块".format(a))
        a = random.randint(1, 100)
        coin += 3000
        print("剩余金额：", coin)
        du = input("你还要继续么？输入y继续，输入其他结束游戏:")
        if du=="y":
            print("游戏继续")
            continue
        else:
            print("游戏结束")
            break

